package org.gxuwz.core.action;

import java.util.List;

import org.gxuwz.core.entity.TReimbursement;
import org.gxuwz.core.service.IReimbursementService;
import org.springframework.beans.factory.annotation.Autowired;

import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.ModelDriven;

public class ReimbursementAction extends ActionSupport implements ModelDriven<TReimbursement>{
	TReimbursement reim = new TReimbursement();
	List<TReimbursement> list;
	String name;
	String perscode;
	String A;
	
	@Autowired
	IReimbursementService reimService;
	
	
	@Override
	public TReimbursement getModel() {
		// TODO Auto-generated method stub
		return reim;
	}
	
	public String list() {
		list=reimService.getAll(name, perscode);
		System.out.println(list.get(0)+"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
		return "list";
	}

	public String jilu(){
		list= reimService.getAllJiLu();
		System.out.println(list.get(0)+"sssssssssssssssjjjjjjjjjjjjhhhhhhhhhh");
		return   "jilu";
	}
	public String sava(){
		reimService.addFiles(reim);
		return this.list();
	}
	
	public String getByPersCode(){
		reim=reimService.getByPerscode(perscode);
		return "list";
	}

	public String edit(){
		reim = reimService.getByPerscode(perscode);
		return "edit";
	}
	
	public String update(){
		reimService.update(reim);
		return list();
	}
	public String delete(){
		reim = reimService.getByPerscode(perscode);
		reimService.delete(reim);
		return this.list();
	}

	public TReimbursement getReim() {
		return reim;
	}

	public void setReim(TReimbursement reim) {
		this.reim = reim;
	}

	public List<TReimbursement> getList() {
		return list;
	}

	public void setList(List<TReimbursement> list) {
		this.list = list;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getPerscode() {
		return perscode;
	}

	public void setPerscode(String perscode) {
		this.perscode = perscode;
	}

	public IReimbursementService getReimService() {
		return reimService;
	}

	public void setReimService(IReimbursementService reimService) {
		this.reimService = reimService;
	}

	public String getA() {
		return A;
	}

	public void setA(String a) {
		A = a;
	}
	
}
